﻿#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLuaBase.lua_CSFunction;
#endif

using XLua;
using System.Collections.Generic;


namespace XLua.CSObjectWrap
{
    using Utils = XLua.Utils;
    public class BunkerHitPointWrap 
    {
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(BunkerHitPoint);
			Utils.BeginObjectRegister(type, L, translator, 0, 0, 3, 3);
			
			
			
			Utils.RegisterFunc(L, Utils.GETTER_IDX, "singlePoints", _g_get_singlePoints);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "areas", _g_get_areas);
            Utils.RegisterFunc(L, Utils.GETTER_IDX, "colliders", _g_get_colliders);
            
			Utils.RegisterFunc(L, Utils.SETTER_IDX, "singlePoints", _s_set_singlePoints);
            Utils.RegisterFunc(L, Utils.SETTER_IDX, "areas", _s_set_areas);
            Utils.RegisterFunc(L, Utils.SETTER_IDX, "colliders", _s_set_colliders);
            
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 4, 0, 0);
			Utils.RegisterFunc(L, Utils.CLS_IDX, "AutoFix", _m_AutoFix_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "FindNearestPointOnMesh", _m_FindNearestPointOnMesh_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "GetNearestPositionAndNormal", _m_GetNearestPositionAndNormal_xlua_st_);
            
			
            
			
			
			
            Utils.RegisterFunc(L, Utils.CLS_IDX, "New", __CreateInstanceNew);
			Utils.EndClassRegister(type, L, translator);
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstance(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 1)
				{
					
					var gen_ret = new BunkerHitPoint();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to BunkerHitPoint constructor!");
            
        }

        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstanceNew(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 0)
				{
					
					var gen_ret = new BunkerHitPoint();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to BunkerHitPoint constructor!");
            
        }

        
		
        
		
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_AutoFix_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
			    int gen_param_count = LuaAPI.lua_gettop(L);
            
                if(gen_param_count == 1&& translator.Assignable<BunkerHitPointArea>(L, 1)) 
                {
                    BunkerHitPointArea _point = (BunkerHitPointArea)translator.GetObject(L, 1, typeof(BunkerHitPointArea));
                    
                    BunkerHitPoint.AutoFix( _point );
                    
                    
                    
                    return 0;
                }
                if(gen_param_count == 3&& translator.Assignable<UnityEngine.Transform>(L, 1)&& translator.Assignable<System.Collections.Generic.List<UnityEngine.Vector3>>(L, 2)&& translator.Assignable<System.Collections.Generic.List<UnityEngine.Vector3>>(L, 3)) 
                {
                    UnityEngine.Transform _point = (UnityEngine.Transform)translator.GetObject(L, 1, typeof(UnityEngine.Transform));
                    System.Collections.Generic.List<UnityEngine.Vector3> _positions = (System.Collections.Generic.List<UnityEngine.Vector3>)translator.GetObject(L, 2, typeof(System.Collections.Generic.List<UnityEngine.Vector3>));
                    System.Collections.Generic.List<UnityEngine.Vector3> _directions = (System.Collections.Generic.List<UnityEngine.Vector3>)translator.GetObject(L, 3, typeof(System.Collections.Generic.List<UnityEngine.Vector3>));
                    
                    BunkerHitPoint.AutoFix( _point, _positions, _directions );
                    
                    
                    
                    return 0;
                }
                if(gen_param_count == 2&& translator.Assignable<UnityEngine.Transform>(L, 1)&& translator.Assignable<System.Collections.Generic.List<UnityEngine.Vector3>>(L, 2)) 
                {
                    UnityEngine.Transform _point = (UnityEngine.Transform)translator.GetObject(L, 1, typeof(UnityEngine.Transform));
                    System.Collections.Generic.List<UnityEngine.Vector3> _positions = (System.Collections.Generic.List<UnityEngine.Vector3>)translator.GetObject(L, 2, typeof(System.Collections.Generic.List<UnityEngine.Vector3>));
                    
                    BunkerHitPoint.AutoFix( _point, _positions );
                    
                    
                    
                    return 0;
                }
                if(gen_param_count == 1&& translator.Assignable<UnityEngine.Transform>(L, 1)) 
                {
                    UnityEngine.Transform _point = (UnityEngine.Transform)translator.GetObject(L, 1, typeof(UnityEngine.Transform));
                    
                    BunkerHitPoint.AutoFix( _point );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
            return LuaAPI.luaL_error(L, "invalid arguments to BunkerHitPoint.AutoFix!");
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_FindNearestPointOnMesh_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
                
                {
                    UnityEngine.Vector3 _point;translator.Get(L, 1, out _point);
                    UnityEngine.Transform _root = (UnityEngine.Transform)translator.GetObject(L, 2, typeof(UnityEngine.Transform));
                    
                        var gen_ret = BunkerHitPoint.FindNearestPointOnMesh( _point, _root );
                        translator.PushUnityEngineVector3(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_GetNearestPositionAndNormal_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
                
                {
                    UnityEngine.Mesh _targetMesh = (UnityEngine.Mesh)translator.GetObject(L, 1, typeof(UnityEngine.Mesh));
                    UnityEngine.Transform _objTrans = (UnityEngine.Transform)translator.GetObject(L, 2, typeof(UnityEngine.Transform));
                    UnityEngine.Vector3 _position;translator.Get(L, 3, out _position);
                    UnityEngine.Vector3 _direction;translator.Get(L, 4, out _direction);
                    
                    BunkerHitPoint.GetNearestPositionAndNormal( _targetMesh, _objTrans, ref _position, ref _direction );
                    translator.PushUnityEngineVector3(L, _position);
                        translator.UpdateUnityEngineVector3(L, 3, _position);
                        
                    translator.PushUnityEngineVector3(L, _direction);
                        translator.UpdateUnityEngineVector3(L, 4, _direction);
                        
                    
                    
                    
                    return 2;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_singlePoints(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                BunkerHitPoint gen_to_be_invoked = (BunkerHitPoint)translator.FastGetCSObj(L, 1);
                translator.Push(L, gen_to_be_invoked.singlePoints);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 1;
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_areas(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                BunkerHitPoint gen_to_be_invoked = (BunkerHitPoint)translator.FastGetCSObj(L, 1);
                translator.Push(L, gen_to_be_invoked.areas);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 1;
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_colliders(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                BunkerHitPoint gen_to_be_invoked = (BunkerHitPoint)translator.FastGetCSObj(L, 1);
                translator.Push(L, gen_to_be_invoked.colliders);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 1;
        }
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _s_set_singlePoints(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                BunkerHitPoint gen_to_be_invoked = (BunkerHitPoint)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.singlePoints = (System.Collections.Generic.List<BunkerSingleHitPoint>)translator.GetObject(L, 2, typeof(System.Collections.Generic.List<BunkerSingleHitPoint>));
            
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 0;
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _s_set_areas(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                BunkerHitPoint gen_to_be_invoked = (BunkerHitPoint)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.areas = (System.Collections.Generic.List<BunkerHitPointArea>)translator.GetObject(L, 2, typeof(System.Collections.Generic.List<BunkerHitPointArea>));
            
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 0;
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _s_set_colliders(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                BunkerHitPoint gen_to_be_invoked = (BunkerHitPoint)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.colliders = (System.Collections.Generic.List<BunkerHitPointCollider>)translator.GetObject(L, 2, typeof(System.Collections.Generic.List<BunkerHitPointCollider>));
            
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 0;
        }
        
		
		
		
		
    }
}
